import java.util.*;
public class Test{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNextInt()) {
            List<Integer> list = new ArrayList<>();
            list.add(sc.nextInt());
            if(list.size() == 1) {
                System.out.println(list.get(0));
                return;
            }
            int[] dp = new int[list.size()+1];
            dp[0] = list.get(0);
            dp[1] = Math.max(list.get(0),list.get(1));
            for(int i = 2; i < list.size(); i++) {
                dp[i] = Math.max(list.get(i)+dp[i-2],dp[i-1]);
            }
            System.out.println(dp[list.size()]);
        }
    }
}